//
//  MNDSetGestureTableViewController.m
//  miniwangdai2
//
//  Created by 谭伟 on 2017/3/19.
//  Copyright © 2017年 谭谭伟. All rights reserved.
//

#import "MNDSetGestureTableViewController.h"
#import "MNDGestureViewController.h"
#import "UserDefaultsTool.h"
#import <SVProgressHUD.h>
#import "UIColor+HMAddition.h"
@interface MNDSetGestureTableViewController ()
@property (weak, nonatomic) IBOutlet UISwitch *gestureSwitch;

@end

@implementation MNDSetGestureTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"";
    _gestureSwitch.on = [UserDefaultsTool boolForKey:@"gestureSwitch"];
//    [UIStoryboard]

}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBarHidden = NO;
//    [self.navigationController setNavigationBarHidden:<#(BOOL)#>]
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
    self.navigationController.navigationBarHidden = YES;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)gestureSwitch:(UISwitch *)sender {

    if (sender.on == YES) {
        [UserDefaultsTool saveBool:YES forKey:@"gestureSwitch"];
        
        [SVProgressHUD showSuccessWithStatus:@"手势密码已开启"];
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
        });
        
    }else {
        
        [UserDefaultsTool saveBool:NO forKey:@"gestureSwitch"];
        [SVProgressHUD showSuccessWithStatus:@"手势密码已关闭"];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
        });
    }
    
}

- (void)gotoGestureVC {
    MNDGestureViewController *gestureViewcontroller = [[MNDGestureViewController alloc]init];
    gestureViewcontroller.view.backgroundColor = [UIColor whiteColor];
    
    //隐藏topgestureview
    gestureViewcontroller.topGestureView.hidden = YES;
    gestureViewcontroller.tipLabel.text = @"请输入手势验证";
    gestureViewcontroller.tipLabel.textColor = [UIColor blackColor];
    gestureViewcontroller.forgetPasswordBtn.hidden = NO;
    gestureViewcontroller.otherAcountLoginBtn.hidden = NO;
    gestureViewcontroller.navigationController.navigationBarHidden = NO;
    [self.navigationController pushViewController:gestureViewcontroller animated:YES];
    
}






@end
